﻿#region using
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using dotNET.Utility;
using dotNET.Utility.Security;
using dotNET.Data;
using dotNET.Repository;
using dotNET.Domain.Entities;
using dotNET.Application.Infrastructure;
using dotNET.Dto;
#endregion

namespace dotNET.Application.App
{
    public class AreaListApp : App, IAreaListApp
    {
        public IRepositoryBase<AreaList> _AreaListRep { get; set; }

        #region 地区菜单  
        public async Task<List<AreaList>> GetMenuListAsync()
        {

            var result = await _AreaListRep.GetListAsync("Where `AreaType` !=@AreaType ", new { AreaType = 3 });


            return result.ToList();
        }
        #endregion

        #region 列表
        public async Task<List<AreaList>> GetListAsync(long ParentId)
        {
            Sql sql = Sql.Builder;
            sql = sql.Where("`ParentID`=@ParentID", new { ParentID = ParentId });

            return (await _AreaListRep.GetListAsync(sql.SQL, sql.Arguments)).ToList();
        }

        #endregion
    }
}